package com.lp.learn.learnspringboot.controller;

import com.lp.learn.learnspringboot.entity.Properties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@Controller
public class HelloController {
    @Autowired
    private Properties properties;

    @RequestMapping("/getHello")
    @ResponseBody
    public String getHello(){
        return "Hello world";
    }
    @RequestMapping("/")
    public String index(ModelMap modelMap){
        modelMap.addAttribute("host","127.0.0.1");
        System.out.println(properties.getJdbcUser());
        System.out.println(properties.getJdbcPassword());
        return "index";
    }
}
